package cn.iocoder.an.module.mold.dal.mysql.rechecktask;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.rechecktask.RecheckTaskDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.rechecktask.vo.*;

/**
 * 复检任务 Mapper
 *
 * @author ykk
 */
@Mapper
public interface RecheckTaskMapper extends BaseMapperX<RecheckTaskDO> {

    default PageResult<RecheckTaskDO> selectPage(RecheckTaskPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecheckTaskDO>()
                .likeIfPresent(RecheckTaskDO::getCode, reqVO.getCode())
                .eqIfPresent(RecheckTaskDO::getDrawingNoId, reqVO.getDrawingNoId())
                .eqIfPresent(RecheckTaskDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(RecheckTaskDO::getAssigneerId, reqVO.getAssigneerId())
                .eqIfPresent(RecheckTaskDO::getAssigneerIds, reqVO.getAssigneerIds())
                .eqIfPresent(RecheckTaskDO::getAssigneerNames, reqVO.getAssigneerNames())
                .eqIfPresent(RecheckTaskDO::getRecheckId, reqVO.getRecheckId())
                .eqIfPresent(RecheckTaskDO::getUrgency, reqVO.getUrgency())
                .eqIfPresent(RecheckTaskDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(RecheckTaskDO::getNextRecheckTime, reqVO.getNextRecheckTime())
                .betweenIfPresent(RecheckTaskDO::getRealRecheckTime, reqVO.getRealRecheckTime())
                .betweenIfPresent(RecheckTaskDO::getTaskCreateTime, reqVO.getTaskCreateTime())
                .betweenIfPresent(RecheckTaskDO::getTaskReceiveTime, reqVO.getTaskReceiveTime())
                .betweenIfPresent(RecheckTaskDO::getJobStartTime, reqVO.getJobStartTime())
                .betweenIfPresent(RecheckTaskDO::getTaskStartTime, reqVO.getTaskStartTime())
                .betweenIfPresent(RecheckTaskDO::getTaskEndTime, reqVO.getTaskEndTime())
                .eqIfPresent(RecheckTaskDO::getTaskExecutionDuration, reqVO.getTaskExecutionDuration())
                .betweenIfPresent(RecheckTaskDO::getActualStartTime, reqVO.getActualStartTime())
                .betweenIfPresent(RecheckTaskDO::getActualEndTime, reqVO.getActualEndTime())
                .eqIfPresent(RecheckTaskDO::getActualExecutionDuration, reqVO.getActualExecutionDuration())
                .eqIfPresent(RecheckTaskDO::getIsCompleted, reqVO.getIsCompleted())
                .eqIfPresent(RecheckTaskDO::getAuditDescription, reqVO.getAuditDescription())
                .eqIfPresent(RecheckTaskDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(RecheckTaskDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RecheckTaskDO::getId));
    }

}